const mysql = require('mysql')

// 创建连接池
const pool = mysql.createPool({
  host: '127.0.0.1',
  user: 'root',
  passowrd: '123456',
  datebase: 'test',
  port: '3506',
})

/* 在数据池中操作 */
pool.getConnection((err, connection) => {
  connection.query('SELECT * FROM tdb_goods;', (error, results, fields) => {

    console.log(results);
    console.log(fields);
    // 结束会话
    connection.release()

    // 抛出错误
    if (error) throw error;
  })
})
